home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX" Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL" Begin VB.Form Form1 BorderStyle = 1 'Fixed Single Caption = "Auto Backup" ClientHeight = 5400 ClientLeft = 45 ClientTop = 330 ClientWidth = 5940 Icon = "Main.frx":0000 KeyPreview = -1 'True LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5400 ScaleWidth = 5940 StartUpPosition = 2 'CenterScreen Begin VB.Timer Timer1 Interval = 59000 Left = 0 Top = 4920 End Begin VB.CommandButton Command3 Cancel = -1 'True Caption = "Minimizar e salvar as altera es (ESC)" Height = 495 Left = 960 TabIndex = 0 Top = 4800 Width = 1695 End Begin VB.CommandButton Command2 Caption = "Sair" Height = 495 Left = 3360 TabIndex = 1 Top = 4800 Width = 1695 End Begin TabDlg.SSTab SSTab1 Height = 4575 Left = 120 TabIndex = 2 Top = 120 Width = 5700 _ExtentX = 10054 _ExtentY = 8070 _Version = 393216 Style = 1 Tabs = 5 TabsPerRow = 5 TabHeight = 520 ShowFocusRect = 0 'False TabCaption(0) = "Hora/Dia" TabPicture(0) = "Main.frx":0E42 Tab(0).ControlEnabled= -1 'True Tab(0).Control(0)= "CheckBox4" Tab(0).Control(0).Enabled= 0 'False Tab(0).Control(1)= "CheckBox1" Tab(0).Control(1).Enabled= 0 'False Tab(0).Control(2)= "Label9" Tab(0).Control(2).Enabled= 0 'False Tab(0).Control(3)= "Label4" Tab(0).Control(3).Enabled= 0 'False Tab(0).Control(4)= "OptionButton2" Tab(0).Control(4).Enabled= 0 'False Tab(0).Control(5)= "Label5" Tab(0).Control(5).Enabled= 0 'False Tab(0).Control(6)= "Label6" Tab(0).Control(6).Enabled= 0 'False Tab(0).Control(7)= "CheckBox2(1)" Tab(0).Control(7).Enabled= 0 'False Tab(0).Control(8)= "CheckBox2(7)" Tab(0).Control(8).Enabled= 0 'False Tab(0).Control(9)= "CheckBox2(6)" Tab(0).Control(9).Enabled= 0 'False Tab(0).Control(10)= "CheckBox2(5)" Tab(0).Control(10).Enabled= 0 'False Tab(0).Control(11)= "CheckBox2(4)" Tab(0).Control(11).Enabled= 0 'False Tab(0).Control(12)= "CheckBox2(3)" Tab(0).Control(12).Enabled= 0 'False Tab(0).Control(13)= "CheckBox2(2)" Tab(0).Control(13).Enabled= 0 'False Tab(0).Control(14)= "OptionButton3" Tab(0).Control(14).Enabled= 0 'False Tab(0).Control(15)= "Label8" Tab(0).Control(15).Enabled= 0 'False Tab(0).Control(16)= "OptionButton1" Tab(0).Control(16).Enabled= 0 'False Tab(0).Control(17)= "Label7" Tab(0).Control(17).Enabled= 0 'False Tab(0).Control(18)= "Label3" Tab(0).Control(18).Enabled= 0 'False Tab(0).Control(19)= "MaskEdBox2" Tab(0).Control(19).Enabled= 0 'False Tab(0).Control(20)= "MaskEdBox1" Tab(0).Control(20).Enabled= 0 'False Tab(0).Control(21)= "Command6" Tab(0).Control(21).Enabled= 0 'False Tab(0).ControlCount= 22 TabCaption(1) = "Arquivos/Diret rios" TabPicture(1) = "Main.frx":0E5E Tab(1).ControlEnabled= 0 'False Tab(1).Control(0)= "CheckBox3" Tab(1).Control(0).Enabled= 0 'False Tab(1).Control(1)= "Label1" Tab(1).Control(1).Enabled= 0 'False Tab(1).Control(2)= "Command5" Tab(1).Control(2).Enabled= 0 'False Tab(1).Control(3)= "Drive1" Tab(1).Control(3).Enabled= 0 'False Tab(1).Control(4)= "Dir1" Tab(1).Control(4).Enabled= 0 'False Tab(1).Control(5)= "Command1" Tab(1).Control(5).Enabled= 0 'False Tab(1).Control(6)= "List1" Tab(1).Control(6).Enabled= 0 'False Tab(1).Control(7)= "Command4" Tab(1).Control(7).Enabled= 0 'False Tab(1).Control(8)= "File1" Tab(1).Control(8).Enabled= 0 'False Tab(1).ControlCount= 9 TabCaption(2) = "Destino" TabPicture(2) = "Main.frx":0E7A Tab(2).ControlEnabled= 0 'False Tab(2).Control(0)= "Label2" Tab(2).Control(0).Enabled= 0 'False Tab(2).Control(1)= "Text1" Tab(2).Control(1).Enabled= 0 'False Tab(2).Control(2)= "Dir2" Tab(2).Control(2).Enabled= 0 'False Tab(2).Control(3)= "Drive2" Tab(2).Control(3).Enabled= 0 'False Tab(2).ControlCount= 4 TabCaption(3) = "Progresso" TabPicture(3) = "Main.frx":0E96 Tab(3).ControlEnabled= 0 'False Tab(3).Control(0)= "Label10" Tab(3).Control(0).Enabled= 0 'False Tab(3).Control(1)= "Label11" Tab(3).Control(1).Enabled= 0 'False Tab(3).Control(2)= "Label12" Tab(3).Control(2).Enabled= 0 'False Tab(3).Control(3)= "Label13" Tab(3).Control(3).Enabled= 0 'False Tab(3).Control(4)= "Label14" Tab(3).Control(4).Enabled= 0 'False Tab(3).Control(5)= "Command7" Tab(3).Control(5).Enabled= 0 'False Tab(3).ControlCount= 6 TabCaption(4) = "Sobre" TabPicture(4) = "Main.frx":0EB2 Tab(4).ControlEnabled= 0 'False Tab(4).Control(0)= "Label16" Tab(4).Control(0).Enabled= 0 'False Tab(4).Control(1)= "Label15" Tab(4).Control(1).Enabled= 0 'False Tab(4).ControlCount= 2 Begin VB.CommandButton Command7 Caption = "Ver arquivo de log..." Height = 495 Left = -73800 TabIndex = 43 Top = 3720 Width = 3255 End Begin VB.FileListBox File1 Height = 1650 Left = -72000 MultiSelect = 2 'Extended TabIndex = 15 Top = 2040 Width = 2535 End Begin VB.CommandButton Command4 Caption = "+ Diret Height = 375 Left = -73440 TabIndex = 14 Top = 3885 Width = 1215 End Begin VB.ListBox List1 Height = 1230 ItemData = "Main.frx":0ECE Left = -74880 List = "Main.frx":0ED0 MultiSelect = 2 'Extended Sorted = -1 'True TabIndex = 13 Top = 720 Width = 5415 End Begin VB.CommandButton Command1 Caption = "Excluir" Height = 375 Left = -70800 TabIndex = 12 Top = 3885 Width = 1215 End Begin VB.DirListBox Dir1 Height = 1215 Left = -74880 TabIndex = 11 Top = 2460 Width = 2775 End Begin VB.DriveListBox Drive1 Height = 315 Left = -74880 TabIndex = 10 Top = 2040 Width = 2775 End Begin VB.CommandButton Command5 Caption = "+ Arquivo(s)" Height = 375 Left = -72120 TabIndex = 9 Top = 3885 Width = 1215 End Begin VB.CommandButton Command6 Caption = "Efetuar backup j Height = 495 Left = 3720 TabIndex = 8 Top = 3780 Width = 1695 End Begin VB.DriveListBox Drive2 Height = 315 Left = -73680 TabIndex = 5 Top = 1200 Width = 2895 End Begin VB.DirListBox Dir2 Height = 2565 Left = -73680 TabIndex = 4 Top = 1680 Width = 2895 End Begin VB.TextBox Text1 Height = 285 Left = -74640 Locked = -1 'True TabIndex = 3 Top = 720 Width = 4935 End Begin MSMask.MaskEdBox MaskEdBox1 Height = 285 Left = 1845 TabIndex = 6 TabStop = 0 'False Top = 930 Width = 615 _ExtentX = 1085 _ExtentY = 503 _Version = 393216 MaxLength = 5 Mask = "##:##" PromptChar = "_" End Begin MSMask.MaskEdBox MaskEdBox2 Height = 285 Left = 1845 TabIndex = 7 Top = 1290 Width = 615 _ExtentX = 1085 _ExtentY = 503 _Version = 393216 MaxLength = 5 Mask = "##:##" PromptChar = "_" End Begin VB.Label Label15 AutoSize = -1 'True Caption = " 1999 Alexandre Moro" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = -73253 TabIndex = 45 Top = 1800 Width = 2010 End Begin VB.Label Label16 Alignment = 2 'Center AutoSize = -1 'True Caption = "Por favor me envie suas sugest es e coment rios!" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = -1 'True Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = -74400 MouseIcon = "Main.frx":0ED2 MousePointer = 99 'Custom TabIndex = 44 Top = 2640 Width = 4305 End Begin VB.Label Label14 Alignment = 2 'Center Caption = " " BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 600 Left = -74880 TabIndex = 42 Top = 2880 Width = 5400 WordWrap = -1 'True End Begin VB.Label Label13 Alignment = 2 'Center Caption = " " BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 480 Left = -74880 TabIndex = 41 Top = 2280 Width = 5400 WordWrap = -1 'True End Begin VB.Label Label12 Alignment = 2 'Center Caption = " " BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = -74880 TabIndex = 40 Top = 1800 Width = 5400 End Begin VB.Label Label11 Alignment = 2 'Center Caption = " " BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 480 Left = -74880 TabIndex = 39 Top = 1200 Width = 5400 WordWrap = -1 'True End Begin VB.Label Label10 Alignment = 2 'Center Caption = " " BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = -74880 TabIndex = 38 Top = 720 Width = 5400 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Arquivos / Diret rios a serem copiados (por ordem alfab tica):" Height = 195 Left = -74880 TabIndex = 37 Top = 480 Width = 4350 End Begin VB.Label Label2 AutoSize = -1 'True Caption = "Diret rio de destino:" Height = 195 Left = -74640 TabIndex = 36 Top = 480 Width = 1410 End Begin VB.Label Label3 AutoSize = -1 'True Caption = "Efetuar o backup..." Height = 195 Left = 240 TabIndex = 35 Top = 480 Width = 1365 End Begin VB.Label Label7 AutoSize = -1 'True Caption = "horas:minutos" Height = 195 Left = 2640 TabIndex = 34 Top = 1335 Width = 975 End Begin MSForms.OptionButton OptionButton1 Height = 345 Left = 1560 TabIndex = 33 Top = 900 Width = 405 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 5 Size = "714;609" Value = "1" GroupName = "a" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin VB.Label Label8 AutoSize = -1 'True Caption = "horas:minutos" Height = 195 Left = 2640 TabIndex = 32 Top = 975 Width = 975 End Begin MSForms.OptionButton OptionButton3 Height = 345 Left = 1560 TabIndex = 31 Top = 2100 Width = 1215 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 5 Size = "2143;609" Value = "1" Caption = "diariamente" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox2 Height = 345 Index = 2 Left = 1560 TabIndex = 30 Top = 2460 Width = 1300 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "2293;609" Value = "0" Caption = "segunda-feira" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox2 Height = 345 Index = 3 Left = 2880 TabIndex = 29 Top = 2460 Width = 1110 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "1958;609" Value = "0" Caption = "ter a-feira" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox2 Height = 345 Index = 4 Left = 4080 TabIndex = 28 Top = 2460 Width = 1200 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "2117;609" Value = "0" Caption = "quarta-feira" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox2 Height = 345 Index = 5 Left = 1560 TabIndex = 27 Top = 2820 Width = 1185 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "2090;609" Value = "0" Caption = "quinta-feira" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox2 Height = 345 Index = 6 Left = 2880 TabIndex = 26 Top = 2820 Width = 1125 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "1984;609" Value = "0" Caption = "sexta-feira" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox2 Height = 345 Index = 7 Left = 4080 TabIndex = 25 Top = 2820 Width = 930 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "1640;609" Value = "0" Caption = "s bado" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox2 Height = 345 Index = 1 Left = 1560 TabIndex = 24 Top = 3180 Width = 1005 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "1773;609" Value = "0" Caption = "domingo" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin VB.Label Label6 AutoSize = -1 'True Caption = "quando:" Height = 195 Left = 765 TabIndex = 23 Top = 2175 Width = 585 End Begin VB.Label Label5 AutoSize = -1 'True Caption = "sempre Height = 195 Left = 585 TabIndex = 22 Top = 975 Width = 765 End Begin MSForms.OptionButton OptionButton2 Height = 345 Left = 1560 TabIndex = 21 Top = 1260 Width = 405 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 5 Size = "714;609" Value = "0" GroupName = "a" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin VB.Label Label4 AutoSize = -1 'True Caption = "ou a cada:" Height = 195 Left = 585 TabIndex = 20 Top = 1335 Width = 765 End Begin VB.Label Label9 Alignment = 2 'Center AutoSize = -1 'True Caption = "(intervalo iniciado a partir de agora, ou sempre que o aplicativo for carregado)" Height = 390 Left = 1560 TabIndex = 19 Top = 1620 Width = 3420 WordWrap = -1 'True End Begin MSForms.CheckBox CheckBox1 Height = 345 Left = 360 TabIndex = 18 Top = 3540 Width = 1935 VariousPropertyBits= 1015023643 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "3413;609" Value = "1" Caption = "Gravar arquivo de log" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox3 Height = 495 Left = -74760 TabIndex = 17 Top = 3825 Width = 1215 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "2143;873" Value = "1" Caption = "Incluir subdiret rios" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End Begin MSForms.CheckBox CheckBox4 Height = 375 Left = 360 TabIndex = 16 Top = 3960 Width = 2055 BackColor = -2147483633 ForeColor = -2147483630 DisplayStyle = 4 Size = "3625;661" Value = "0" Caption = "Backup incremental" FontHeight = 165 FontCharSet = 0 FontPitchAndFamily= 2 End End Begin VB.Menu mnu_1 Caption = "mnu_1" Visible = 0 'False Begin VB.Menu MnuRestaurar Caption = "Restaurar" End Begin VB.Menu MnuBackup Caption = "Efetuar backup j End Begin VB.Menu MnuSair Caption = "Sair" End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim NLoops As Integer, LoopDup As Integer, ListaComFoco As Boolean, Days As Byte Dim sRet As String, Ret As Long, MskErr1 As Boolean, MskErr2 As Boolean Dim DirDestino As String, SemArqIni As Boolean Dim WindowsDir As String, NLoopsTimer As Byte, Intervalo As Date, HoraIn cio As Date Dim Padr o As Boolean, ltimoBackup As Date, Result As Long, Msg As Long, ErroAbertura As Boolean Dim XDir(2) As New Collection, FromPath As String Private Const Arq = "Autobak.ini" Private Const SW_SHOW = 5 Private Declare Function WritePrivateProfileString& Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As String, ByVal lpFileName As String) Private Declare Function GetPrivateProfileString& Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) Private Declare Function GetWindowsDirectory& Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Type NOTIFYICONDATA cbSize As Long hwnd As Long uId As Long uFlags As Long uCallBackMessage As Long hIcon As Long szTip As String * 64 End Type Private Const NIM_ADD = &H0 Private Const NIM_MODIFY = &H1 Private Const NIM_DELETE = &H2 Private Const NIF_MESSAGE = &H1 Private Const NIF_ICON = &H2 Private Const NIF_TIP = &H4 Private Const WM_MOUSEMOVE = &H200 Private Const WM_LBUTTONDOWN = &H201 Private Const WM_LBUTTONUP = &H202 Private Const WM_LBUTTONDBLCLK = &H203 Private Const WM_RBUTTONDOWN = &H204 Private Const WM_RBUTTONUP = &H205 Private Const WM_RBUTTONDBLCLK = &H206 Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean Private nid As NOTIFYICONDATA Private Type ListaArqs Nome As String Tamanho As Long End Type Private Arquivos() As ListaArqs Private Sub GetDirs(Path As String) 'on error Resume Next Dim vDirName As String, LastDir As String Dim i As Integer 'Adjust so No Deletion of Drive If Len(Path$) < 4 Then Exit Sub If Right(Path$, 1) <> "\" Then XDir(0).Add Path$ Path$ = Path$ & "\" End If vDirName = Dir(Path, vbDirectory) ' Retrieve the first entry. Do While vDirName <> "" If vDirName <> "." And vDirName <> ".." Then If (GetAttr(Path & vDirName)) = vbDirectory Then LastDir = vDirName 'Finds Directory Name then Repeats GetDirs (Path$ & vDirName) vDirName = Dir(Path$, vbDirectory) Do Until vDirName = LastDir Or vDirName = "" vDirName = Dir Loop If vDirName = "" Then Exit Do End If End If vDirName = Dir Loop End Sub Private Function ExtractText(FullText As String, token As String, Optional StartAtLeft = True, Optional IncludeLeftSide = True) As String 'ExtractText(Path$, ":", False, False) Dim i As Integer If StartAtLeft = True And IncludeLeftSide = True Then ExtractText = FullText For i = 1 To Len(FullText) If Mid(FullText, i, 1) = token Then ExtractText = Left(FullText, i - 1) Exit Function End If Next ElseIf StartAtLeft = True And IncludeLeftSide = False Then ExtractText = FullText For i = 1 To Len(FullText) If Mid(FullText, i, 1) = token Then ExtractText = Right(FullText, Len(FullText) - i) Exit Function End If Next ElseIf StartAtLeft = False And IncludeLeftSide = True Then ExtractText = "" For i = Len(FullText) To 1 Step -1 If Mid(FullText, i, 1) = token Then ExtractText = Left(FullText, i - 1) Exit Function End If Next ElseIf StartAtLeft = False And IncludeLeftSide = False Then ExtractText = "" For i = Len(FullText) To 1 Step -1 If Mid(FullText, i, 1) = token Then ExtractText = Right(FullText, Len(FullText) - i) Exit Function End If Next End If End Function Private Sub MtxAdicionaArq(CamCompleto As String) If UBound(Arquivos) = 1 Then Arquivos(1).Nome = CamCompleto Arquivos(1).Tamanho = FileLen(CamCompleto) ReDim Preserve Arquivos(2) Else Arquivos(UBound(Arquivos)).Nome = CamCompleto Arquivos(UBound(Arquivos)).Tamanho = FileLen(CamCompleto) ReDim Preserve Arquivos(UBound(Arquivos) + 1) End If End Sub Private Sub MtxAdicionaDir(ByVal Caminho As String) On Error GoTo erro Dim B As String, n As Integer, CaminhoCurto As String If Not Right(Caminho, 1) = "*" Then Caminho = Caminho & "*.*" CaminhoCurto = Left(Caminho, Len(Caminho) - 3) If Not UBound(Arquivos) = 1 Then n = UBound(Arquivos) + 1 ReDim Preserve Arquivos(n) End If B = Dir(Caminho) If B = "" Then Exit Sub Else Arquivos(UBound(Arquivos) - 1).Nome = CaminhoCurto & B Arquivos(UBound(Arquivos) - 1).Tamanho = FileLen(CaminhoCurto & B) End If Do B = Dir If B = "" Then Exit Do With Arquivos(n) .Nome = CaminhoCurto & B .Tamanho = FileLen(CaminhoCurto & B) End With n = n + 1 ReDim Preserve Arquivos(n) Loop Exit Sub erro: MsgBox "MtxAdicionaDir:" & vbLf & vbLf & Err.Number & ":" & Err.Description, vbCritical Resume sa End Sub Private Sub AdicionaItem(OnlyFile As Boolean, Optional WithSubs As Boolean = False) On Error GoTo erro Screen.MousePointer = vbHourglass Dim AddPath As String If Right(Dir1.Path, 1) = "\" Then AddPath = Dir1.Path Else AddPath = Dir1.Path & "\" End If If Not OnlyFile Then If WithSubs Then Dim i As Integer, d As String GetDirs (AddPath) For i = 1 To XDir(0).Count If VerificaDup(XDir(0).Item(i) & "\*.*") Then MsgBox "Este tem j existe na lista:" & vbLf & vbLf & XDir(0).Item(i) & "\*.*", vbExclamation Else List1.AddItem XDir(0).Item(i) & "\*.*" End If Next i For i = XDir(0).Count To 1 Step -1 XDir(0).Remove (i) Next i End If If List1.ListCount = 0 Then List1.AddItem AddPath & "*.*" GoTo sa Else If VerificaDup(AddPath & "*.*") Then MsgBox "Este tem j existe na lista:" & vbLf & vbLf & AddPath & "*.*", vbExclamation GoTo sa Else List1.AddItem AddPath & "*.*" GoTo sa End If End If Else Dim Entries As Integer For NLoops = 0 To File1.ListCount - 1 If File1.Selected(NLoops) Then Entries = Entries + 1 If Entries > 1 Then GoTo cont End If Next NLoops cont: If Entries = 1 Then If VerificaDup(AddPath & File1.FileName) Then MsgBox "Este tem j existe na lista:" & vbLf & vbLf & AddPath & File1.FileName, vbExclamation GoTo sa Else List1.AddItem AddPath & File1.FileName GoTo sa End If ElseIf Entries > 1 Then For NLoops = 0 To File1.ListCount - 1 If File1.Selected(NLoops) Then If VerificaDup(AddPath & File1.List(NLoops)) Then MsgBox "Este tem j existe na lista:" & vbLf & vbLf & AddPath & File1.List(NLoops), vbExclamation Else List1.AddItem AddPath & File1.List(NLoops) End If End If Next NLoops End If End If Screen.MousePointer = vbDefault Exit Sub erro: MsgBox Err.Number & vbLf & Err.Description, vbCritical Resume sa End Sub Private Sub Backup() On Error GoTo erro Screen.MousePointer = vbHourglass Dim DateBak As Date, TimeBak As Date, ErrString As String Dim NDirs As Integer, File As String, TskID As Double, TotArquivos As Long, TotArquivosCopiados As Long Dim ErroDest As Byte, ArqAtr As Byte, Tam As Long SSTab1.Tab = 3 TimeBak = Now DateBak = Date Me.Caption = "Gerando lista de arquivos..." If Not Right(DirDestino, 1) = "\" Then DirDestino = DirDestino & "\" For NLoops = 0 To List1.ListCount - 1 If Right(List1.List(NLoops), 1) = "*" Then MtxAdicionaDir (Left(List1.List(NLoops), Len(List1.List(NLoops)) - 3)) Else MtxAdicionaArq (List1.List(NLoops)) End If Next NLoops Me.Caption = "Efetuando backup..." If CheckBox1 Then Open WindowsDir & "Log Autobak.txt" For Output As #1 Print #1, "Iniciando backup s " & Now Print #1, End If Label10.Caption = "Copiando agora" Label12.Caption = "para" TotArquivos = UBound(Arquivos) - 1 For NLoops = 0 To TotArquivos DoEvents If Not Arquivos(NLoops).Nome = "" Then ArqAtr = GetAttr(Arquivos(NLoops).Nome) Label11.Caption = Arquivos(NLoops).Nome Label13.Caption = DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) Label14.Caption = "Arquivo " & NLoops & " de " & TotArquivos cont: If CheckBox4 Then If ArqAtr And vbArchive <> 0 Then If CheckBox1 Then Print #1, Arquivos(NLoops).Nome & " --> " & DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) & ", status: "; FileCopy Arquivos(NLoops).Nome, DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) SetAttr Arquivos(NLoops).Nome, (ArqAtr - vbArchive) If CheckBox1 Then Print #1, "Ok!" Tam = Tam + FileLen(Arquivos(NLoops).Nome) TotArquivosCopiados = TotArquivosCopiados + 1 End If Else If CheckBox1 Then Print #1, Arquivos(NLoops).Nome & " --> " & DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) & ", status: "; FileCopy Arquivos(NLoops).Nome, DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) If CheckBox1 Then Print #1, "Ok!" Tam = Tam + FileLen(Arquivos(NLoops).Nome) TotArquivosCopiados = TotArquivosCopiados + 1 End If Label14.Caption = "Arquivo " & NLoops & " de " & TotArquivos & ", total: " & _ Format(Tam / 1024 / 1024, "standard") & " Mb" End If Next NLoops If CheckBox1 Then Print #1, Print #1, "Copiados " & TotArquivosCopiados & " arquivos, " & Format(Tam / 1024 / 1024, "standard") & " Mb, das " & _ Format(TimeBak, "short time") & " s " & Format(Time, "short time") & " de " & _ Format(DateBak, "short date") & "." Close #1 End If Label10.Caption = "" Label11.Caption = "" Label12.Caption = "" Label13.Caption = "" Label14.Caption = "Copiados " & TotArquivosCopiados & " arquivos, " & Format(Tam / 1024 / 1024, "standard") & " Mb, das " & _ Format(TimeBak, "short time") & " s " & Format(Time, "short time") & " de " & _ Format(DateBak, "short date") & "." ReDim Arquivos(0) Me.Caption = "Auto Backup" Screen.MousePointer = vbDefault Exit Sub erro: ErrString = vbLf & vbLf & "Enquanto tentava copiar:" & vbLf & Arquivos(NLoops).Nome & _ vbLf & "para" & vbLf & DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) & vbLf & _ vbLf & "Tentar novamente?" If CheckBox1 Then Print #1, "ERRO: " & Err.Number & " - " & Err.Description; Select Case Err.Number Case 5 'Invalid procedure call Resume Next Case 52 'Bad filename MsgBox "Nome de arquivo inv lido! (erro 52)" & vbLf & vbLf & Arquivos(NLoops).Nome, vbExclamation Resume Next Case 53 'File not found MsgBox "Arquivo n o encontrado! (erro 53)" & vbLf & vbLf & Arquivos(NLoops).Nome, vbExclamation Resume Next Case 57 'Device I/O error If MsgBox("O disco de destino n o est pronto! (erro 57)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont Case 61 'Disk full If MsgBox("Drive de destino cheio! (erro 61)" & ErrString, vbExclamation + vbYesNo) = vbYes Then Resume cont Case 70 'Permission denied If MsgBox("Diret rio ou drive de destino protegido! (erro 70)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont Case 71 'Disk not ready If MsgBox("O disco de destino n o est pronto! (erro 71)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont Case 75 'Path/file access error SetAttr DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome), (GetAttr(DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome)) - vbReadOnly) Resume cont Case 76 'Path not found If MsgBox("Diret rio de destino inexistente! (erro 76)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont Case Else If MsgBox("Erro imprevisto!" & vbLf & vbLf & Err.Number & ": " & Err.Description & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont End Select Resume sa End Sub Private Function RetornaNomeArq(ByVal Arq As String) As String 'Arq o caminho completo, retorna o arquivo Dim n As Integer For n = Len(Arq) To 1 Step -1 If Mid(Arq, n, 1) = "\" Then RetornaNomeArq = Right(Arq, Len(Arq) - n) Exit Function End If Next n End Function Private Sub ChecaHora() On Error GoTo erro If OptionButton1 And Not HoraIn cio = vbEmpty Then If HoraIn cio = TimeSerial(Hour(Time), Minute(Time), 0) Then Me.Caption = "Realizando Backup..." Me.Refresh Backup ltimoBackup = TimeSerial(Hour(Time), Minute(Time), 0) Me.Caption = "Auto Backup" Me.Refresh End If End If If OptionButton2 And Not Intervalo = vbEmpty Then If TimeSerial(Hour(Time), Minute(Time), 0) = TimeValue(Intervalo + ltimoBackup) Then Me.Caption = "Realizando Backup..." Me.Refresh Backup ltimoBackup = TimeSerial(Hour(Time), Minute(Time), 0) Me.Caption = "Auto Backup" Me.Refresh End If End If Exit Sub erro: If Not Err.Number = 13 Then MsgBox Err.Number & vbLf & Err.Description Resume sa End Sub Private Sub Inicializa() On Error GoTo erro Dim Lenght As Byte WindowsDir = String(255, 0) Lenght = GetWindowsDirectory(WindowsDir, 254) WindowsDir = Left(WindowsDir, Lenght) If Not Right(WindowsDir, 1) = "\" Then WindowsDir = WindowsDir & "\" If Dir(WindowsDir & "Autobak.ini") = "" Then If Dir(WindowsDir & "Autobak.bak") <> "" Then FileCopy WindowsDir & "Autobak.bak", WindowsDir & "Autobak.ini" Else SemArqIni = True End If End If sRet = String(255, 0) Ret = GetPrivateProfileString("Quando", "Sempre s", "", sRet, 255, Arq) sRet = Left(sRet, Ret) If Not Ret = 0 Then If sRet = "???" Then HoraIn cio = vbEmpty Else MaskEdBox1.Text = sRet HoraIn cio = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0) End If End If sRet = String(255, 0) Ret = GetPrivateProfileString("Quando", "ACada", "", sRet, 255, Arq) sRet = Left(sRet, Ret) If Not Ret = 0 Then If sRet = "???" Then Intervalo = vbEmpty Else MaskEdBox2.Text = sRet Intervalo = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0) End If End If sRet = String(255, 0) Ret = GetPrivateProfileString("Quando", "Padr o", "", sRet, 255, Arq) sRet = Left(sRet, Ret) If Not Ret = 0 Then If sRet = "False" Then Padr o = False Else Padr o = True End If End If sRet = String(255, 0) Ret = GetPrivateProfileString("Quando", "Dias", "", sRet, 255, Arq) sRet = Left(sRet, Ret) If Not Ret = 0 Then Dim BsRet As Byte BsRet = CByte(sRet) If Int(BsRet / 64) = 1 Then CheckBox2(7).Value = True: BsRet = BsRet - 64 If Int(BsRet / 32) = 1 Then CheckBox2(6).Value = True: BsRet = BsRet - 32 If Int(BsRet / 16) = 1 Then CheckBox2(5).Value = True: BsRet = BsRet - 16 If Int(BsRet / 8) = 1 Then CheckBox2(4).Value = True: BsRet = BsRet - 8 If Int(BsRet / 4) = 1 Then CheckBox2(3).Value = True: BsRet = BsRet - 4 If Int(BsRet / 2) = 1 Then CheckBox2(2).Value = True: BsRet = BsRet - 2 If Int(BsRet / 1) = 1 Then CheckBox2(1).Value = True End If sRet = String(255, 0) Ret = GetPrivateProfileString("Log", "Gravar", "", sRet, 255, Arq) sRet = Left(sRet, Ret) If Not Ret = 0 Then If sRet = "N o" Then CheckBox1.Value = False sRet = String(255, 0) Ret = GetPrivateProfileString("Backup", "Incremental", "", sRet, 255, Arq) sRet = Left(sRet, Ret) If Not Ret = 0 Then If sRet = "Sim" Then CheckBox4.Value = True sRet = String(255, 0) Ret = GetPrivateProfileString("Destino", "Dir", "", sRet, 255, Arq) sRet = Left(sRet, Ret) If Not Ret = 0 Then On Error GoTo erro1 Dir2.Path = sRet Drive2.Drive = Left(sRet, 2) On Error GoTo erro End If cont: DirDestino = sRet Text1.Text = DirDestino NLoops = 0 ReDim Arquivos(0) start: sRet = String(255, 0) Ret = GetPrivateProfileString("Entradas", NLoops, "", sRet, 255, Arq) If Ret = 0 Then ltimoBackup = TimeSerial(Hour(Time), Minute(Time), 0): Exit Sub sRet = Left(sRet, Ret) List1.AddItem sRet NLoops = NLoops + 1 GoTo start Exit Sub erro: MsgBox Err.Number & vbLf & vbLf & Err.Description, vbCritical, "Initializing!" Resume Next erro1: If Err.Number = 68 Or Err.Number = 76 Then 'MsgBox "O diret rio ou drive de destino n o est dispon vel!" & vbLf & vbLf & _ "Deixado como padr o ""C:\""", vbExclamation 'sRet = "C:\" Else MsgBox Err.Number & vbLf & Err.Description End If Resume cont End Sub Private Sub SalvaAltera On Error GoTo erro Screen.MousePointer = vbHourglass On Error Resume Next Name WindowsDir & Arq As WindowsDir & "Autobak.bak" Kill WindowsDir & Arq On Error GoTo erro If Not MaskEdBox1.Text = "__:__" Then Call WritePrivateProfileString("Quando", "Sempre s", MaskEdBox1.Text, Arq) HoraIn cio = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0) Else Call WritePrivateProfileString("Quando", "Sempre s", "???", Arq) HoraIn cio = vbEmpty End If If Not MaskEdBox2.Text = "__:__" Then Call WritePrivateProfileString("Quando", "ACada", MaskEdBox2.Text, Arq) Intervalo = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0) Else Call WritePrivateProfileString("Quando", "ACada", "???", Arq) Intervalo = vbEmpty End If If OptionButton1 Then Call WritePrivateProfileString("Quando", "Padr o", False, Arq) Else Call WritePrivateProfileString("Quando", "Padr o", True, Arq) End If If OptionButton3 Then Call WritePrivateProfileString("Quando", "Dias", "0", Arq) Else Days = 0 Dim n As Byte For n = 0 To 6 If CheckBox2(n + 1) Then Days = Days + 2 ^ n Next n Call WritePrivateProfileString("Quando", "Dias", Days, Arq) End If If CheckBox1 Then Call WritePrivateProfileString("Log", "Gravar", "Sim", Arq) Else Call WritePrivateProfileString("Log", "Gravar", "N o", Arq) End If If CheckBox4 Then Call WritePrivateProfileString("Backup", "Incremental", "Sim", Arq) Else Call WritePrivateProfileString("Backup", "Incremental", "N o", Arq) End If Call WritePrivateProfileString("Destino", "Dir", Text1.Text, Arq) For NLoops = 0 To List1.ListCount - 1 If WritePrivateProfileString("Entradas", CStr(NLoops), List1.List(NLoops), Arq) = 0 Then MsgBox "Arquivo .INI cheio." & vbLf & " ltima entrada salva: " & List1.List(NLoops - 1), vbCritical GoTo sa End If Next NLoops Screen.MousePointer = vbDefault Me.WindowState = vbMinimized Exit Sub erro: MsgBox Err.Number & vbLf & Err.Description, vbCritical Resume sa End Sub Private Function VerificaDup(Item As String) As Boolean For LoopDup = 0 To List1.ListCount - 1 If List1.List(LoopDup) = Item Then VerificaDup = True Exit Function End If Next LoopDup VerificaDup = False End Function Private Function VerificaErros() As Boolean If List1.ListCount = 0 Then MsgBox "Voc precisa especificar pelo menos um arquivo ou diret rio para o backup!", vbCritical SSTab1.Tab = 1 GoTo erro End If If Len(Text1.Text) = 0 Then MsgBox "Voc precisa especificar o diret rio de destino.", vbCritical SSTab1.Tab = 2 Text1.SetFocus GoTo erro ElseIf Text1.Text = "c:\" Or Text1.Text = "C:\" Then If MsgBox("O diret rio de destino foi deixado como C:\." & vbLf & vbLf & "Confirma?", _ vbYesNo + vbExclamation) = vbNo Then SSTab1.Tab = 2 Text1.SetFocus GoTo erro End If ElseIf OptionButton1 And MaskEdBox1.Text = "__:__" Then MsgBox "Voc precisa especificar uma hora para o backup!", vbCritical SSTab1.Tab = 0 MaskEdBox1.SetFocus GoTo erro ElseIf OptionButton2 And MaskEdBox2.Text = "__:__" Then MsgBox "Voc precisa especificar um intervalo para o backup!", vbCritical SSTab1.Tab = 0 MaskEdBox2.SetFocus GoTo erro End If VerificaErros = False Exit Function erro: VerificaErros = True End Function Private Sub CheckBox2_Click(Index As Integer) OptionButton3.Value = False End Sub Private Sub Command1_Click() On Error GoTo erro For NLoops = List1.ListCount - 1 To 0 Step -1 If List1.Selected(NLoops) Then List1.RemoveItem (NLoops) Next NLoops Exit Sub erro: If Err.Number = 68 Then MsgBox "O drive selecionado n o est dispon vel.", vbCritical Else MsgBox Err.Number & vbLf & Err.Description, vbCritical End If Resume sa End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Command3_Click() If Not VerificaErros Then SalvaAltera End Sub Private Sub Command4_Click() If CheckBox3.Value = True Then Call AdicionaItem(False, True) Else Call AdicionaItem(False) End If End Sub Private Sub Command5_Click() AdicionaItem (True) End Sub Private Sub Command6_Click() If MsgBox("Isto efetuar o backup dos arquivos/diret rios selecionados agora." & vbLf & _ vbLf & "Deseja continuar?", vbQuestion + vbYesNo) = vbYes Then Backup End Sub Private Sub Command7_Click() ShellExecute hwnd, "open", WindowsDir & "Log Autobak.txt", vbNullString, vbNullString, SW_SHOW End Sub Private Sub Dir2_Change() Text1.Text = Dir2.Path DirDestino = Text1.Text End Sub Private Sub Drive1_Change() On Error GoTo erro Dir1.Path = Drive1.Drive Exit Sub erro: If Err.Number = 68 Then MsgBox "O drive selecionado n o est dispon vel.", vbCritical Drive1.Drive = "c:" Else MsgBox Err.Number & vbLf & Err.Description, vbCritical End If Resume sa End Sub Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub Private Sub Drive2_Change() On Error GoTo erro Dir2.Path = Drive2.Drive Exit Sub erro: If Err.Number = 68 Then MsgBox "O drive selecionado n o est dispon vel.", vbCritical Drive2.Drive = "c:" Else MsgBox Err.Number & vbLf & Err.Description, vbCritical End If Resume sa End Sub Private Sub File1_DblClick() AdicionaItem (True) End Sub Private Sub Form_Activate() If Not Padr o Then MaskEdBox1.SetFocus Else MaskEdBox2.SetFocus End If DoEvents If Not SemArqIni Then Me.WindowState = vbMinimized End Sub Private Sub Form_Initialize() If App.PrevInstance Then MsgBox "J existe outra c pia do aplicativo sendo executada!", vbCritical ErroAbertura = True Unload Me Set Form1 = Nothing End End If End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If ListaComFoco Then If KeyCode = 46 Then Command1_Click End Sub Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" KeyAscii = 0 End If End Sub Private Sub Form_Load() Dir1.Path = "C:\" Dir2.Path = "C:\" Inicializa With nid .cbSize = Len(nid) .hwnd = Me.hwnd .uId = vbNull .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE .uCallBackMessage = WM_MOUSEMOVE .hIcon = Me.Icon .szTip = "Auto Backup" & vbNullChar End With Shell_NotifyIcon NIM_ADD, nid End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Me.ScaleMode = vbPixels Then Msg = X Else Msg = X / Screen.TwipsPerPixelX End If Select Case Msg Case WM_LBUTTONUP '514 restore form window Me.WindowState = vbNormal Result = SetForegroundWindow(Me.hwnd) Me.Show Case WM_LBUTTONDBLCLK '515 restore form window Me.WindowState = vbNormal Result = SetForegroundWindow(Me.hwnd) Me.Show Case WM_RBUTTONUP '517 display popup menu Result = SetForegroundWindow(Me.hwnd) Me.PopupMenu Me.mnu_1 End Select End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If ErroAbertura Then Exit Sub 'If MsgBox("Isto encerrar o aplicativo." & vbLf & vbLf & "Tem certeza?", vbQuestion + vbYesNo) = vbYes Then Unload Me Shell_NotifyIcon NIM_DELETE, nid Set Form1 = Nothing End 'Else ' Cancel = True 'End If End Sub Private Sub Form_Resize() If Me.WindowState = vbMinimized Then Me.Hide End Sub Private Sub Label16_Click() ShellExecute hwnd, "open", "mailto:alb@cwb.matrix.com.br", vbNullString, vbNullString, SW_SHOW End Sub Private Sub List1_GotFocus() ListaComFoco = True End Sub Private Sub List1_LostFocus() ListaComFoco = False End Sub Private Sub MaskEdBox1_GotFocus() FocalizaCampo MskErr1 = False OptionButton1.Value = True End Sub Private Sub MaskEdBox1_LostFocus() On Error GoTo erro If MskErr2 Or MaskEdBox1.Text = "__:__" Then Exit Sub HoraIn cio = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0) Exit Sub erro: If Err.Number = 13 Then MsgBox "Hora inv lida.", vbCritical Else MsgBox Err.Number & vbLf & Err.Description End If MskErr1 = True MaskEdBox1.SetFocus HoraIn cio = vbEmpty Resume sa End Sub Private Sub MaskEdBox2_GotFocus() OptionButton2.Value = True FocalizaCampo MskErr2 = False End Sub Sub FocalizaCampo() Screen.ActiveForm.ActiveControl.SelStart = 0 Screen.ActiveForm.ActiveControl.SelLength = Len(Screen.ActiveForm.ActiveControl.Text) End Sub Private Sub MaskEdBox2_LostFocus() On Error GoTo erro If MskErr1 Then Exit Sub If MaskEdBox2.Text = "__:__" Then OptionButton1.Value = True HoraIn cio = "00:00" GoTo sa End If Intervalo = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0) Exit Sub erro: If Err.Number = 13 Then MsgBox "Intervalo inv lido.", vbCritical Else MsgBox Err.Number & vbLf & Err.Description End If MskErr2 = True Intervalo = vbEmpty MaskEdBox2.SetFocus Resume sa End Sub Private Sub MnuBackup_Click() Command6_Click End Sub Private Sub MnuRestaurar_Click() Me.WindowState = vbNormal Result = SetForegroundWindow(Me.hwnd) Me.Show End Sub Private Sub MnuSair_Click() Unload Me End Sub Private Sub OptionButton1_Click() MaskEdBox1.SetFocus End Sub Private Sub OptionButton2_Click() MaskEdBox2.SetFocus End Sub Private Sub OptionButton3_Click() For NLoops = 1 To 7 CheckBox2(NLoops).Value = False Next NLoops OptionButton3.Value = True End Sub Private Sub Text1_GotFocus() FocalizaCampo End Sub Private Sub Timer1_Timer() If Intervalo = vbEmpty And HoraIn cio = vbEmpty Then Exit Sub If Not OptionButton3 Then For NLoopsTimer = 1 To 7 If CheckBox2(NLoopsTimer).Value = True Then If Format(Date, "w") = NLoopsTimer Then ChecaHora Next NLoopsTimer Else ChecaHora End If End Sub